package com.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class DBTester implements TesterIf{
	
	public void run() {
		dotest();
	}
	
	public void dotest() {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysite", "root", "admin");
			PreparedStatement ps = conn.prepareStatement("select * from test");
			ResultSet rs = ps.executeQuery();
			while(rs.next()) {
				System.out.println("id="+rs.getInt(1)+", name="+rs.getString(2));
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
